--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/07c_RDPlots_log.txt
  log type:  text
 opened on:  25 Jun 2026, 12:58:48
r; t=0.00 12:58:48

. 
. di "=================================================================="
==================================================================
r; t=0.00 12:58:48

. di "  07c_RDPlots_W1W2.do"
  07c_RDPlots_W1W2.do
r; t=0.00 12:58:48

. di "  Date: $S_DATE  Time: $S_TIME"
  Date: 25 Jun 2026  Time: 12:58:48
r; t=0.00 12:58:48

. di "=================================================================="
==================================================================
r; t=0.00 12:58:48

. 
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style + extended outcome indices))
r; t=0.11 12:58:48

. 
. /*==============================================================================
>   PART 1: APPLY JEEA-STYLE SAMPLE RESTRICTIONS
> ==============================================================================*/
. 
. local jeea_controls hhven_parents hhven_spouse hhven_other jobopp labven ///
>                     typeworkven1 typeworkven2 typeworkven3 ///
>                     written_cont average yrseduc healthmig frdfam ///
>                     smartven owner electven waterven sewageven female ///
>                     age_panel child_venez time_col
r; t=0.00 12:58:48

. 
. gen sample_roster = .
(13,580 missing values generated)
r; t=0.00 12:58:48

. qui reg trt_hh `jeea_controls'
r; t=2.21 12:58:50

. replace sample_roster = e(sample)
(13,580 real changes made)
r; t=0.00 12:58:50

. replace sample_roster = 0 if gasto_capita == . & trt_hh != .
(119 real changes made)
r; t=0.00 12:58:50

. replace sample_roster = 0 if employed == . & trt_hh != .
(88 real changes made)
r; t=0.00 12:58:50

. replace sample_roster = 0 if hora_semana == . & trt_hh != . & asalariado_num == 1
(64 real changes made)
r; t=0.00 12:58:50

. replace sample_roster = 0 if anx_depr == .
(2 real changes made)
r; t=0.00 12:58:50

. replace sample_roster = 0 if health_pca == .
(8 real changes made)
r; t=0.00 12:58:50

. bysort family_id: egen sample_reg = max(sample_roster)
r; t=0.02 12:58:50

. keep if (orden == 1 | orden == 2) & sample_reg == 1
(6,451 observations deleted)
r; t=0.02 12:58:50

. keep if abs(daterd) <= 206
(2,138 observations deleted)
r; t=0.01 12:58:50

. 
. * Bins of 20 days for the binned scatter
. egen bin = cut(daterd), at(-210(20)210)
r; t=0.02 12:58:50

. 
. /*==============================================================================
>   PART 2: HELPER PROGRAM — JEEA Figure 3 style RD plot for one outcome
> ==============================================================================*/
. 
. capture program drop _make_rdplot
r; t=0.00 12:58:50

. program define _make_rdplot
  1.     args var label_str
  2.     capture confirm variable `var'
  3.     if _rc {
  4.         di "  `var': skipped (variable not found)"
  5.         exit
  6.     }
  7.     qui count if !missing(`var', daterd)
  8.     if r(N) < 100 {
  9.         di "  `var': skipped (too few observations)"
 10.         exit
 11.     }
 12. 
.     capture drop var_bin
 13.     bysort wave_num bin: egen var_bin = mean(`var')
 14.     bysort wave_num bin: egen bin_xmean = mean(daterd)
 15.     bysort wave_num bin: gen first = (_n == 1)
 16. 
.     twoway ///
>         (lfitci `var' daterd if wave_num==1 & daterd<0,  lcolor(navy)      acolor(navy%18)      alpattern(solid)  
>  lwidth(medthick)) ///
>         (lfitci `var' daterd if wave_num==1 & daterd>=0, lcolor(navy)      acolor(navy%18)      alpattern(solid)  
>  lwidth(medthick)) ///
>         (lfitci `var' daterd if wave_num==2 & daterd<0,  lcolor(cranberry) acolor(cranberry%18) alpattern(longdash
> ) lwidth(medthick)) ///
>         (lfitci `var' daterd if wave_num==2 & daterd>=0, lcolor(cranberry) acolor(cranberry%18) alpattern(longdash
> ) lwidth(medthick)) ///
>         (scatter var_bin bin_xmean if wave_num==1 & first, msymbol(O) mcolor(navy)      mfcolor(white)     msize(m
> edlarge)) ///
>         (scatter var_bin bin_xmean if wave_num==2 & first, msymbol(S) mcolor(cranberry) mfcolor(cranberry) msize(m
> edlarge)) ///
>         , xline(0, lcolor(black) lwidth(medthin)) ///
>           title("`label_str'", size(medsmall) color(black)) ///
>           ytitle("`label_str'", size(small)) ///
>           xtitle("Days to RAMV deadline (June 8, 2018) — eligible to the left of 0", size(small)) ///
>           xlabel(-200(50)200, nogrid notick labsize(small)) ///
>           ylabel(, nogrid notick labsize(small)) ///
>           legend(order(9 "Wave 1 (2020)" 10 "Wave 2 (2021)") rows(1) position(6) ///
>                  region(fcolor(white) lcolor(black) lwidth(thin)) size(small)) ///
>           graphregion(color(white) margin(small)) ///
>           plotregion(fcolor(white) lcolor(black) lwidth(thin) margin(small)) ///
>           bgcolor(white) ///
>           yscale(noline) xscale(noline) ///
>           note("Notes: Markers are mean outcome by 20-day bins of arrival date; lines are linear fits on each side
>  of" ///
>                "the RAMV cutoff with 95% CI bands. Sample restricted to JEEA-style analysis sample (|days| <= 206)
> ." ///
>                "Eligible households are those who arrived strictly before the deadline (left of 0).", ///
>                size(vsmall) color(black) span) ///
>           name(rd_`var', replace)
 17. 
.     capture graph export "$figs/rd_`var'.png", replace width(1400)
 18.     capture graph drop rd_`var'
 19.     drop var_bin bin_xmean first
 20. end
r; t=0.00 12:58:50

. 
. /*==============================================================================
>   PART 3: BUILD RD PLOTS FOR HEADLINE OUTCOMES
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:58:50

. di "--- Generating RD plots ---"
--- Generating RD plots ---
r; t=0.00 12:58:50

. 
. * Group A — Economic well-being
. _make_rdplot jeea_index_wellbeing  "Well-being index (SD)"
r; t=2.62 12:58:53

. _make_rdplot labour_income         "Log monthly labor income"
r; t=1.39 12:58:54

. _make_rdplot gasto_capita          "Log per-capita HH consumption"
r; t=1.42 12:58:56

. _make_rdplot income_maxhh          "Log HH-max labor income"
r; t=1.46 12:58:57

. _make_rdplot employed              "Employed [=1]"
r; t=1.44 12:58:59

. 
. * Group B — Labor
. _make_rdplot jeea_index_labor      "Labor index (SD)"
r; t=1.49 12:59:00

. _make_rdplot formal                "Formal employment [=1]"
r; t=1.42 12:59:02

. _make_rdplot hora_semana           "Log weekly hours (salaried)"
r; t=1.42 12:59:03

. 
. * Group C — Services
. _make_rdplot jeea_index_services   "Services index (SD)"
r; t=1.39 12:59:04

. _make_rdplot sisben                "SISBEN registration [=1]"
r; t=1.40 12:59:06

. _make_rdplot subs                  "Subsidized health [=1]"
r; t=1.41 12:59:07

. _make_rdplot bank                  "Bank account [=1]"
r; t=1.38 12:59:09

. _make_rdplot govtr                 "Govt. transfers [=1]"
r; t=1.37 12:59:10

. 
. * Group D — Health
. _make_rdplot health_pca            "Health PCA index (SD)"
r; t=1.38 12:59:11

. _make_rdplot anx_depr              "Severe anxiety/depression [=1]"
r; t=1.34 12:59:13

. 
. * Group E — Food
. _make_rdplot index_food            "Food security index (SD)"
r; t=1.36 12:59:14

. _make_rdplot skip_meals            "Skipped meals last month [=1]"
r; t=1.33 12:59:15

. 
. * Group F — Housing
. _make_rdplot index_housing         "Housing quality index (SD)"
r; t=1.37 12:59:17

. 
. * Group G — Integration
. _make_rdplot index_integration     "Social integration index (SD)"
r; t=1.36 12:59:18

. _make_rdplot belonging             "Sense of belonging (1-4)"
r; t=1.32 12:59:19

. _make_rdplot trust_col             "Trust in Colombians (1-5)"
r; t=1.38 12:59:21

. 
. * Group H — Discrimination
. _make_rdplot index_discrim         "Discrimination index (SD)"
r; t=1.36 12:59:22

. _make_rdplot discrim_ever          "Ever discriminated against [=1]"
r; t=1.40 12:59:24

. 
. * Group I — Migration intentions
. _make_rdplot intend_stay           "Intends to stay in Colombia [=1]"
r; t=1.41 12:59:25

. 
. * Group J — COVID
. _make_rdplot index_covid           "COVID resilience index (SD)"
r; t=1.38 12:59:26

. _make_rdplot covid_received_aid    "Received COVID aid [=1]"
r; t=1.49 12:59:28

. 
. * Group M — Remittances
. _make_rdplot index_remit           "Remittances index (SD)"
r; t=1.41 12:59:29

. _make_rdplot remit_now             "Sends remittances now [=1]"
r; t=1.44 12:59:31

. 
. * Group N — Financial access
. _make_rdplot index_fin_access      "Financial access index (SD)"
r; t=1.34 12:59:32

. _make_rdplot index_digital         "Digital access index (SD)"
r; t=1.35 12:59:33

. 
. di ""

r; t=0.00 12:59:33

. di "  RD plots saved: $figs/"
  RD plots saved: ../outputs/figures_rdplot/
r; t=0.00 12:59:33

. 
. /*==============================================================================
>   PART 4: BUILD PDF
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:33

. di "--- Building PDF ---"
--- Building PDF ---
r; t=0.00 12:59:33

. 
. * Theme tags + parallel arrays
. local themes economic labor services health foodhouse integration ///
>              discrim migration covid remittance digital
r; t=0.00 12:59:33

. local title_economic    "Economic well-being"
r; t=0.00 12:59:33

. local title_labor       "Labor market"
r; t=0.00 12:59:33

. local title_services    "Services and rights"
r; t=0.00 12:59:33

. local title_health      "Health"
r; t=0.00 12:59:33

. local title_foodhouse   "Food and housing"
r; t=0.00 12:59:33

. local title_integration "Integration and trust"
r; t=0.00 12:59:33

. local title_discrim     "Discrimination"
r; t=0.00 12:59:33

. local title_migration   "Migration intentions"
r; t=0.00 12:59:33

. local title_covid       "COVID impacts"
r; t=0.00 12:59:33

. local title_remittance  "Remittances"
r; t=0.00 12:59:33

. local title_digital     "Financial access and digital"
r; t=0.00 12:59:33

. local out_economic    jeea_index_wellbeing labour_income gasto_capita income_maxhh employed
r; t=0.00 12:59:33

. local out_labor       jeea_index_labor formal hora_semana
r; t=0.00 12:59:33

. local out_services    jeea_index_services sisben subs bank govtr
r; t=0.00 12:59:33

. local out_health      health_pca anx_depr
r; t=0.00 12:59:33

. local out_foodhouse   index_food skip_meals index_housing
r; t=0.00 12:59:33

. local out_integration index_integration belonging trust_col
r; t=0.00 12:59:33

. local out_discrim     index_discrim discrim_ever
r; t=0.00 12:59:33

. local out_migration   intend_stay
r; t=0.00 12:59:33

. local out_covid       index_covid covid_received_aid
r; t=0.00 12:59:33

. local out_remittance  index_remit remit_now
r; t=0.00 12:59:33

. local out_digital     index_fin_access index_digital
r; t=0.00 12:59:33

. 
. local part = 0
r; t=0.00 12:59:33

. local plots_in_doc = 0
r; t=0.00 12:59:33

. foreach theme of local themes {
  2.     if `plots_in_doc' == 0 {
  3.         local ++part
  4.         putpdf clear
  5.         putpdf begin, pagesize(letter) margin(left, 0.6in) margin(right, 0.6in)
  6.         putpdf paragraph, halign(center)
  7.         putpdf text ("RD Plots — Wave 1 (2020) and Wave 2 (2021), Part `part'"), bold font(, 14)
  8.         putpdf paragraph
  9.         putpdf text ("Notes: Each panel plots a headline outcome against days to the RAMV deadline (June 8, 201
> 8). Eligible households arrived strictly before the deadline (left of zero). Hollow circles are Wave-1 (short-run)
>  bin means; filled squares are Wave-2 (medium-run) bin means; bins are 20 days wide. Lines are linear fits on each
>  side of the cutoff with 95% CI bands. Standardized indices labeled '(SD)'; binary indicators labeled '[=1]'."), i
> talic font(, 10)
 10.     }
 11. 
.     local title "`title_`theme''"
 12.     local outvars `out_`theme''
 13. 
.     putpdf paragraph
 14.     putpdf text ("`title'"), bold font(, 12)
 15. 
.     foreach v of local outvars {
 16.         capture confirm file "$figs/rd_`v'.png"
 17.         if !_rc {
 18.             putpdf paragraph, halign(center)
 19.             putpdf image "$figs/rd_`v'.png", width(5)
 20.             local ++plots_in_doc
 21.         }
 22.     }
 23. 
.     if `plots_in_doc' >= 6 {
 24.         putpdf save "$out/07c_RDPlots_part`part'.pdf", replace
 25.         local plots_in_doc = 0
 26.     }
 27. }
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/07c_RDPlots_part1.pdf"
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/07c_RDPlots_part2.pdf"
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/07c_RDPlots_part3.pdf"
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/07c_RDPlots_part4.pdf"
r; t=1.39 12:59:35

. if `plots_in_doc' > 0 {
.     putpdf save "$out/07c_RDPlots_part`part'.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/07c_RDPlots_part5.pdf"
r; t=0.07 12:59:35
. }
r; t=0.07 12:59:35

. 
. * Headline file
. copy "$out/07c_RDPlots_part1.pdf" "$out/07c_RDPlots.pdf", replace
(file ../outputs/07c_RDPlots.pdf not found)
r; t=0.01 12:59:35

. 
. di ""

r; t=0.00 12:59:35

. di "  PDF saved:    $out/07c_RDPlots.pdf"
  PDF saved:    ../outputs/07c_RDPlots.pdf
r; t=0.00 12:59:35

. di "                $out/07c_RDPlots_part*.pdf"
                ../outputs/07c_RDPlots_part*.pdf
r; t=0.00 12:59:35

. di "  Figures:      $figs/"
  Figures:      ../outputs/figures_rdplot/
r; t=0.00 12:59:35

. di "  Done."
  Done.
r; t=0.00 12:59:35

. 
. log close
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/07c_RDPlots_log.txt
  log type:  text
 closed on:  25 Jun 2026, 12:59:35
--------------------------------------------------------------------------------------------------------------------
